#!/usr/bin/env python3
# coding=utf-8

# curl -v -X POST -H'Cookie: m=2258:dGVzdDp0ZXN0QHJhYmJpdG1xLnl5' -H'authorization: Basic dGVzdDp0ZXN0QHJhYmJpdG1xLnl5' 'http://localhost:15672/api/exchanges/%2Ftest/amq.default/publish' -d'{"vhost":"/test","name":"amq.default","properties":{"delivery_mode":1,"headers":{}},"routing_key":"concurrent-queue","delivery_mode":"1","payload":"hello","headers":{},"props":{},"payload_encoding":"string"}'
import time
import os
s = 'curl -X POST -H"Cookie: m=2258:dGVzdDp0ZXN0QHJhYmJpdG1xLnl5" -H"authorization: Basic dGVzdDp0ZXN0QHJhYmJpdG1xLnl5" "http://localhost:15672/api/exchanges/%%2Ftest/amq.default/publish" -d\'{"vhost":"/test","name":"amq.default","properties":{"delivery_mode":1,"headers":{}},"routing_key":"%s","delivery_mode":"1","payload":"hello%d","headers":{},"props":{},"payload_encoding":"string"}\''
def push_message(n):
  for i in range(n):
    v= os.system(s % (i%2==0 and "concurrent-queue" or "concurrent-queue2", i))
    time.sleep(0.2)
    print(i)
  print("ok")